using System;

namespace PropertyExpression.ReactiveRelation
{
    internal class OneToManyCollectionNewItemProvider : IOneToManyCollectionNewItemProvider
    {
        private readonly Func<object> senderFunc;
        private readonly Func<string> propertyNameFunc;
        private readonly Func<object> previousValueFunc;

        public OneToManyCollectionNewItemProvider(
            Func<object> senderFunc, 
            Func<string> propertyNameFunc, 
            Func<object> previousValueFunc)
        {
            this.senderFunc = senderFunc;
            this.propertyNameFunc = propertyNameFunc;
            this.previousValueFunc = previousValueFunc;
        }

        public object Sender
        {
            get { return senderFunc(); }
        }

        public string PropertyName
        {
            get { return propertyNameFunc(); }
        }

        public object PreviousValue
        {
            get { return previousValueFunc(); }
        }
    }
}